package test.fairway;

import java.util.Date;

public class S3SessionCredential {
	private String accessKeyId;
	private String secretAccessKey;
	private String sessionToken;
	private Date expiration;
	
	public S3SessionCredential(String accessKeyId, String secretAccessKey, String sessionToken) {
		this(accessKeyId, secretAccessKey, sessionToken, 3600);
	}
	
	public S3SessionCredential(String accessKeyId, String secretAccessKey, String sessionToken, Date expiration) { 
		this(accessKeyId, secretAccessKey, sessionToken, DateUtil.getDurationSeconds(expiration));
	}
	
	public S3SessionCredential(String accessKeyId, String secretAccessKey, String sessionToken, long duration) {
		Date expiration = DateUtil.getExpirationDate(duration);
		
		this.accessKeyId = accessKeyId;
		this.secretAccessKey = secretAccessKey;
		this.sessionToken = sessionToken;
		this.expiration = expiration;
	}
	
	public String getAccessKeyId() {
		return accessKeyId;
	}

	public String getSecretAccessKey() {
		return secretAccessKey;
	}

	public String getSessionToken() {
		return sessionToken;
	}

	public Date getExpiration() {
		return expiration;
	}
}
